package jpg1980.gttunes.dao;

import jpg1980.gttunes.dao.mysql.MySqlDaoFactory;
import jpg1980.utils.Props;

public abstract class DaoFactory
{
	// Selected Dao implementation
	private static int SELECTED_DAO_IMPLEMENTATION = 0;
	// List of dao types supported by the factory
	public static final int NONE = 0;
	public static final int MYSQL = 1;
	
	static
	{
		String daoImpl = Props.properties.getProperty("daoImpl");

		if (daoImpl.compareToIgnoreCase("MYSQL") == 0)
		{
			SELECTED_DAO_IMPLEMENTATION = MYSQL;
		}
		else
			SELECTED_DAO_IMPLEMENTATION = NONE;
	}


	public static DaoFactory getDaoFactory()
	{
		switch (SELECTED_DAO_IMPLEMENTATION)
		{
			case NONE:
				return null;
			case MYSQL:
				return new MySqlDaoFactory();
			default:
				return new MySqlDaoFactory();
		}
	}

	public static DaoFactory getDaoFactory(int whichFactory)
	{
		switch (whichFactory)
		{
			case MYSQL:
				return new MySqlDaoFactory();
			default:
				return new MySqlDaoFactory();
		}
	}

	/*
	 * There will be a method for each dao that can be created. The concrete
	 * factories will have to implement these methods.
	 */
	public abstract AccountDao getAccountDao();
	
	public abstract CarDao getCarDao();
	
	public abstract DriveTrainDao getDriveTrainDao();
	
	public abstract GameDao getGameDao();
	
	public abstract ManufacturerDao getManufacturerDao();
	
	public abstract RoleDao getRoleDao();
	
	public abstract TrackDao getTrackDao();
	
	public abstract TransmissionDao getTransmissionDao();
	
	public abstract TuneBasicDao getTuneBasicDao();
	
	public abstract TuneComplexDao getTuneComplexDao();
	
	public abstract TunerDao getTunerDao();
}
